package com.athuiju.fenxiaoback.handler.exceptionhandler;

import com.athuiju.fenxiaoback.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {


    @ExceptionHandler(Exception.class)
    @ResponseBody
    public R error(Exception e){
        log.error(e.getMessage());
        log.warn(e.getMessage());
        log.info(e.getMessage());
        e.printStackTrace();
        return R.error().put("msg",e.getMessage());
    }
}
